''' Mission 12 - Night Light ''' from codex import * ROOM = 1000 MAX_PERCENT = 20 while True: value = light.read() if value < ROOM: reverse = 1 - value scaled = (reverse/ROOM) * MAX_PERCENT level = int(scaled) pixels.fill(WHITE, brightness = level) else: pixels.fill(BLACK) # I added this in so I don't get blinded # by contiual light when stopped if buttons.was_pressed(BTN_A): break pixels.fill(BLACK)